package com.mlody.chapter2;

/**
 * Created by tmlod_000 on 2014-08-06.
 */
public class CurrentConditionDisplay implements Observer,DisplayElement {
    private float temperature;
    private float humidity;
    private WeatherData weatherData;

    public CurrentConditionDisplay(Subject weatherData) {
        this.weatherData = this.weatherData;
        weatherData.registerObserver(this);
    }

    @Override
    public void display() {
        System.out.println("Current condition"+temperature+"C, Humidity"+humidity);
    }

    @Override
    public void update(float temp, float humidity, float pressure) {
    temperature=temp;
        this.humidity=humidity;
        display();
    }
}
